package com.corona.game;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.Color;
import com.badlogic.gdx.graphics.g2d.Sprite;
import com.corona.Game;
import com.corona.game.util.TextureCache;

/* compiled from: PkmnMap.java */
/* loaded from: pokewilds.jar:com/pkmngen/game/LightFadeIn.class */
class LightFadeIn extends Action {
    public static boolean goAway = false;
    public Action.Layer layer = Action.Layer.gui_114;
    int timer = 0;
    int slow = 3;
    Color color = new Color();
    Sprite sprite = new Sprite(TextureCache.get(Gdx.files.internal("battle/intro_frame6.png")), 0, 0, 160, 144);

    public LightFadeIn(Action nextAction) {
        super(new Object[0]);
        this.nextAction = nextAction;
    }

    @Override // com.corona.game.Action
    public String getCamera() {
        return "gui";
    }

    @Override // com.corona.game.Action
    public Action.Layer getLayer() {
        return this.layer;
    }

    @Override // com.corona.game.Action
    public void firstStep(Game game) {
        goAway = false;
    }

    @Override // com.corona.game.Action
    public void step(Game game) {
        if (goAway) {
            game.actionStack.remove(this);
            return;
        }
        if (this.timer >= 2 * this.slow) {
            if (this.timer < 4 * this.slow) {
                this.color.set(game.uiBatch.getColor());
                game.uiBatch.setColor(1.0f, 1.0f, 1.0f, 0.25f);
                for (int i = -1; i < 2; i++) {
                    for (int j = -1; j < 2; j++) {
                        game.uiBatch.draw(this.sprite, (float) (160 * i), (float) (144 * j));
                    }
                }
                game.uiBatch.setColor(this.color);
            } else if (this.timer < 6 * this.slow) {
                this.color.set(game.uiBatch.getColor());
                game.uiBatch.setColor(1.0f, 1.0f, 1.0f, 0.5f);
                for (int i2 = -1; i2 < 2; i2++) {
                    for (int j2 = -1; j2 < 2; j2++) {
                        game.uiBatch.draw(this.sprite, (float) (160 * i2), (float) (144 * j2));
                    }
                }
                game.uiBatch.setColor(this.color);
            } else if (this.timer == 6 * this.slow) {
                game.insertAction(this.nextAction);
                this.color.set(game.uiBatch.getColor());
                game.uiBatch.setColor(1.0f, 1.0f, 1.0f, 1.0f);
                for (int i3 = -1; i3 < 2; i3++) {
                    for (int j3 = -1; j3 < 2; j3++) {
                        game.uiBatch.draw(this.sprite, (float) (160 * i3), (float) (144 * j3));
                    }
                }
                game.uiBatch.setColor(this.color);
            } else {
                this.color.set(game.uiBatch.getColor());
                game.uiBatch.setColor(1.0f, 1.0f, 1.0f, 1.0f);
                for (int i4 = -1; i4 < 2; i4++) {
                    for (int j4 = -1; j4 < 2; j4++) {
                        game.uiBatch.draw(this.sprite, (float) (160 * i4), (float) (144 * j4));
                    }
                }
                game.uiBatch.setColor(this.color);
                return;
            }
        }
        this.timer++;
    }
}
